package functionInterface;

import org.junit.Test;

import java.util.function.Function;

/**
 * @Author com.alibaba.lizhen
 * @Date 2021/3/23 5:52 下午
 * @Version 1.0
 * @Description
 */
public class FunctionTest {
    @Test
    public void test(){
        Long result = changeNum(100L, (x) -> x + 200L);
        System.out.println(result);
    }

    /**
     *  Function<T,R> 函数式接口
     * @param num
     * @param fun
     * @return
     */
    public Long changeNum(Long num, Function<Long, Long> fun){
        return fun.apply(num);
    }

}
